<?php
/**
 *
 * Created by www.soe-soe.com
 * Author: shijy
 * Date: 2015/12/10
 * Time: 10:56
 */


function getSmarty(){
    static $smartyAdmin;
    if ($smartyAdmin) {
        return $smartyAdmin;
    }
    import('Vendor.Smarty.Smarty');
    $smartyAdmin = new Smarty();
    $smartyAdmin->template_dir = WEB_ROOT.'/Tpl/Wap/';
    $smartyAdmin->compile_dir = RUNTIME_PATH.'Smarty/';
    $smartyAdmin->addPluginsDir(WEB_ROOT.'/smarty_plugin');
    $smartyAdmin->caching = false;
    $smartyAdmin->left_delimiter ='<{';
    $smartyAdmin->right_delimiter='}>';
    $smartyAdmin->assign('module',MODULE_NAME);
    $smartyAdmin->assign('controller',CONTROLLER_NAME);
    $smartyAdmin->assign('action',ACTION_NAME);

    $smartyAdmin->assign('preUploadUrl',C('UPLOAD_RESOURCE_PREFIX'));//
    $smartyAdmin->assign('preStaticUrl',C('STATIC_RESOURCE_PREFIX'));//
    $smartyAdmin->assign('resVersion',RESOURCE_VERSION);//静态资源版本控制

    $smartyAdmin->assign('selfName',C('SELF_NAME'));//编辑自称，如小看，小辰辰
    $smartyAdmin->assign('plantform',CURRENT_PAY);//编辑自称，如小看，小辰辰

    return $smartyAdmin;
}
